package com.mxnet.chongjin.supoman.fragment;


import android.content.Context;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;

import com.mxnet.chongjin.supoman.R;
import com.mxnet.chongjin.supoman.activity.NetConfigActivity;

/**
 * A simple {@link Fragment} subclass.
 */
public class MachineFragment extends Fragment {
    private ImageView mImageView;
    private Context mContext;

    public MachineFragment() {

    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        mContext = this.getActivity();
        View v = inflater.inflate(R.layout.fragment_machine, container, false);
        initView(v);
        return v;
    }

    public void initView(View view) {
        mImageView = view.findViewById(R.id.iv_cus_index);
        mImageView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent();
                intent.setClass(mContext, NetConfigActivity.class);
                mContext.startActivity(intent);
                getActivity().finish();
            }
        });
    }

    @Override
    public void onHiddenChanged(boolean hidden) {
        getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_NOSENSOR);
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
    }
}
